home *** CD-ROM | disk | FTP | other *** search
/ The 640 MEG Shareware Studio 2 / The 640 Meg Shareware Studio CD-ROM Volume II (Data Express)(1993).ISO / basic / imb9108.zip / PROGRAM2.BAS < prev    next >
BASIC Source File  |  1991-06-19  |  2KB  |  72 lines

  1. DECLARE SUB PAUSE ()
  2. DEFINT A-Z
  3.  
  4. '*******************************************************************
  5. '*     PROG2.BAS = = Program to test new combined library files    *
  6. '*     First test the Call interrupt mechanism                     *
  7. '*     Then test the date/time library routines                    *
  8. '*******************************************************************
  9.  
  10. 'The next two instructions include the header files for the individual
  11. 'libraries. You could combine the contents of the two include files
  12. 'into a single lib file named something like 2NDLIB.BI
  13.  
  14. '$INCLUDE: 'QBX.BI'
  15. '$INCLUDE: 'LIBRARY1.BI'
  16.  
  17. DIM Regs AS RegType                    'Registers for CALL Interrupt
  18.  
  19.     CLS
  20.  
  21. '==================== TEST CALL INTERRUPT =============================
  22.  
  23.     PRINT "Testing to see if the CALL Interrupt routine is available"
  24.     PRINT
  25.  
  26. 'We just chose a miscellaneous funtion (&H1B) of interrupt (&H21)
  27. '  to test that the CALL Interrupt routine appears in our new library
  28.  
  29.     Regs.AX = &H1B00                     'Setup the interrupt call to
  30.     CALL Interrupt(&H21, Regs, Regs)     'Get default drive data
  31.  
  32.     AL = Regs.AX AND (&HFF)              'Get lower byte of AX register
  33.  
  34.     IF AL <> &HFF THEN                   'If not an error from interrupt
  35.         SectorsPerCluster& = AL            '  process the results
  36.         BytesPerSector& = Regs.CX
  37.         NumberofClusters& = Regs.DX
  38.         IF NumberofClusters& < 0 THEN      'Handle overflow for large disks
  39.             NumberofClusters& = NumberofClusters& + 65536
  40.         END IF
  41.  
  42. 'Print results
  43.  
  44.         NbrBytes& = SectorsPerCluster& * BytesPerSector& * NumberofClusters&
  45.  
  46.         PRINT USING "Sectors per cluster  =          ##"; SectorsPerCluster&
  47.         PRINT USING "Bytes per sector     =       #,###"; BytesPerSector&
  48.         PRINT USING "Number of clusters   =     ###,###"; NumberofClusters&
  49.         PRINT "                       -----------"
  50.         PRINT USING "Nbr of bytes on disk = ###,###,###"; NbrBytes&
  51.     ELSE
  52.         PRINT "Error during interrupt."
  53.     END IF
  54.  
  55.     PRINT : PAUSE
  56.  
  57. '============== TEST POSPRINT ROUTINE ================================
  58.  
  59.     CLS
  60.     PRINT "Test printing on line 1"
  61.     PosPrint 10, 10, "Test printing with the PosPrint routine"
  62.     PRINT "Test printing on line 2"
  63.     PRINT : PAUSE
  64.  
  65. END
  66.  
  67. SUB PAUSE
  68.     PRINT "Press any key...."
  69.     WHILE LEN(INKEY$) = 0: WEND
  70. END SUB
  71.  
  72.